﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BUS;

public partial class UserControl_Basket : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["DatHang"] != null)
        {
            Basket basket = new Basket();
            DatHangBUS cart = basket.Cart;
            if (cart.ChiTietDatHangs.Count > 0)
            {
                string slSp = cart.ChiTietDatHangs.Sum<ChiTietDatHangBUS>(p => p.SoLuong).ToString();
                lblSanPham.Text = String.Format("Có <b>{0}</b> sản phẩm", slSp);
                lblTongTien.Text = String.Format("Tổng tiền: <b>{0}</b>", cart.strThanhTien);
            }
            else
                lblTongTien.Text = "<b>Chưa có sản phẩm</b>";
        }
        else
            lblTongTien.Text = "<b>Chưa có sản phẩm</b>";
    }
}
